With the rapid popularization of networks and diversification of network applications, the network traffic is expanding, and the network scope is increasing. It is more and more difficult to maintain and manage network devices. Therefore, an important feature of a network device required is: The network device needs to provide the fault detection function; when the path between neighboring network devices is faulty in the communication process, the network device can detect the fault quickly, and set up a new channel in place of the faulty channel or switch the communication from the faulty channel over to other links. Some existing network devices such as Synchronous Digital Hierarchy (SDH) devices and Resilient Packet Ring (RPR) already provide the foregoing function of fault detection. However, a lot of hardware and software still provides no fault detection function. For example, the forwarding engine and interfaces of the Internet Protocol (IP) data packet forwarding devices are unable to implement end-to-end detection.
In the existing network system, fault detection is performed for the path between network devices through a slow handshake (Hello) mechanism. Without assistance of hardware, the fault detection takes a long time. For example, it takes about two seconds to detect the fault of the link between the network devices through an Open Shortest Path First (OSPF) protocol, and it takes about one second to detect the fault of the link between network devices through an Intermediate System-to-Intermediate System (ISIS) protocol. When the data transmission rate is high, for example, the data transmission rate is of a gigabit level, long detection time leads to huge loss of data. Moreover, the detection of the link fault requires the network device nodes to support the routing protocol, and link state detection is impossible for the nodes that do not support the routing protocol.
In order to speed up the detection of faults of the link between network devices and shorten the fault detection time, a Bidirectional Failure Detection (BFD) module is added in the network devices in the prior art. The BFD module sends the fault detection messages quickly to implement fast detection of link faults. The BFD module can perform fault detection for any type of data paths in a network system or between network systems, for example, direct physical links, virtual circuits, tunnels, Multi-Protocol Label Switching (MPLS) Label Switched Paths (LSPs), multi-hop route paths, and indirect paths. After detecting a link fault, the BFD module notifies the upper-layer application modules in the network device such as Interior Gateway Protocol (IGP) module, Border Gateway Protocol (BGP) module, MPLS module, and multicast module to handle the detected fult.
FIG. 1 is a flowchart of detecting link faults through a BFD protocol in the prior art. Supposing that the BFD module in router A performs the fault detection, the fault detection process includes the following steps:
Step 101: The BFD module in router A does not receive the BFD message from the BFD module in router B in the preset time, and believes that the link between router A and router B is faulty.
Step 102: The BFD module in router A sends a BFD Session Down message to the IGP module in router A.
Step 103: The IGP module in router A cuts off the neighboring relation between router A and router B, generates a new link state message that indicates the network topology around router A, and floods the message about change of the network topology to all other routers in the same autonomous domain. Meanwhile, the BFD module in router A sends a notification message of deleting the BFD session.
Step 104: The BFD module in router A deletes the BFD session.
After the fault is cleared on link between router A and router B, the IGP module in router A uses a slow handshake (Hello) mechanism to discover the neighboring router B again, sets up a neighboring relation with router B again, calculates the route to router B, and instructs the BFD module in router A to create a BFD session again.
In the process of developing the present invention, the inventor finds at least the following problems in the prior art:
When the BFD module detects the link fault, the IGP module cuts off the neighboring relation with the router that uses the faulty link, generates a new link state message, floods the network topology change message to all routers in the same autonomous domain, and notifies the BFD module to delete the BFD session. After the links recovers from the fault, the IGP module uses its slow handshake (Hello) mechanism to discover the neighboring router again, sets up a neighboring relation with the neighboring router, and calculates the route to the neighboring router. In this case, if the link between the routers is cut off intermittently, namely, if the link fails but can recover quickly, the link failure time is less than the sending period of the Hello message. For example, the link failure time is a few milliseconds. In this case, because the default time of sending the Hello message from the IGP module is relatively long, which is generally ten seconds, it takes a long time to set up a neighboring relation again. Even if the link recovers quickly, the link is not available until a neighboring relation is set up with the IGP module again and the route is calculated. The convergence time of the IGP module is long, which reduces the convergence performance of recovery of the link. Moreover, massive route calculation consumes many Central Processing Unit (CPU) resources of the router, and affects the working performance of the router.